#pragma comment(linker, "/STACK:10000000")
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
#include <cstdio>
#include <cassert>
#include <string>
#include <cstring>
#define ldb long double
#define LL unsigned long long
#define fi first
#define se second
#define fill(a, c) memset(a, c, sizeof(a))
#define sqr(a) ((a) * (a))
#define nextLine() {int c = 0; while((c = getchar()) != 10 && c != EOF);}
#define getBit(mask, k) (((mask) / pw[k]) % pw[1])
#define setBit(mask, k, l) (((mask) / pw[k + 1] * pw[1] + (l)) * pw[k] + ((mask) % pw[k]))
#define debug(a) cerr << #a << " = " << a << " ";
#define debugl(a) cerr << #a << " = " << a << "\n";
const ldb LDINF = 9128739847123.00;
const ldb eps = 1e-9;
const int INF = 1 << 30;
const ldb pi = fabsl(atan2(0.0, -1.0));
using namespace std;


char s[100010];
int bad[100010];
string t[22];
int n, m;

void Load()
{
	gets(s);
	n = strlen(s);
	cin >> m;
	int i;
	for (i = 0; i < m; i++)
	{
		cin >> t[i];
	}
}

const LL X = 113ll;
vector <pair<int, int> > all;
vector <pair <int, pair<int, int > > > ev;
set <int> was;

void Solve()
{
	int i, j;
	LL hash, h, P;
	for (i = 0; i < m; i++)
	{
		if (n < t[i].size()) continue;
		hash = 0;
		h = 0;
		P = 1;
		for (j = 0; j < t[i].size(); j++)
		{
			hash = hash * X + t[i][j];
			h = h * X + s[j];
			P = P * X;
		}
		for (j = 0; j < n - t[i].size() + 1; j++)
		{
			if (hash == h)
			{
				all.push_back(make_pair(j, j + (int)t[i].size() - 1));
				//bad[j]++;
				//bad[j + t[i].size()]--;
			}
			h *= X;
			h -= P * s[j];
			h += s[j + t[i].size()];
		}
	}
	int res = 0;
	int rpos = 0;
	int pos = 0;
	
	for (i = 0; i < all.size(); i++)
	{
		ev.push_back(make_pair(all[i].first, make_pair(0, i)));
		ev.push_back(make_pair(all[i].second, make_pair(1, i)));
	}
	sort(ev.begin(), ev.end());
	
	for (i = 0; i < ev.size(); i++)
	{
		//cerr << ev[i].first << " " << ev[i].second.first << " " << ev[i].second.second << "\n";
		if (ev[i].second.first == 1)
		{
		//	cerr << "res "  << pos << " " << ev[i].first - 1 << "\n";
			if (ev[i].first - 1 >= pos && ev[i].first - pos > res)
			{
				res = ev[i].first - pos;
				rpos = pos;
			}	
			pos = max(pos, all[ev[i].second.second].first + 1);
		}
	}
	if (pos <= n - 1 && n - pos > res)
	{
		res = n - pos;
		rpos = pos;
	}

	//cerr << s << "\n";
/*	for (i = 0; i < n; i++)
	{
		bad[i] += bd;
		bd = bad[i];
		cerr << bd;
		if (bd == 1)
		{
			if (len > res)
			{
				res = len;
				rpos = pos;
			}
			pos = i + 1;
			len = 0;
			continue;
		}
		len++;
	}
	if (len > res)
	{
		res = len;
		rpos = pos;
	}
	*/
	cout << res << " " << rpos;

}

#define file "c"
int main()
{
	#ifndef ONLINE_JUDGE
		freopen(file".in", "rt", stdin);
		freopen(file".out", "wt", stdout);
	#endif
	Load();
	Solve();
	return 0;
}
